package com.lt.basic.project.pojo.validate.mino.user;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lt.basic.project.common.util.StringUtils;
import com.lt.basic.project.pojo.entity.mino.user.UserVisits;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * la_user_visits搜素对象
 * @author ：LT
 * @Created in : 2023-08-31
 */
@Data
@ApiModel(value="UserVisits搜素对象", description = "搜素对象")
public class UserVisitsSearchValidate implements Serializable {

    private static final long serialVersionUID=1L;



    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Long userId;

    /**
     * 请求类型: GET/POST/PUT
     */
    @ApiModelProperty(value = "请求类型: GET/POST/PUT")
    private String type;

    /**
     * 请求IP
     */
    @ApiModelProperty(value = "请求IP")
    private String ip;

    /**
     * 请求接口
     */
    @ApiModelProperty(value = "请求接口")
    private String url;

    /**
     * 请求方法
     */
    @ApiModelProperty(value = "请求方法")
    private String method;

    /**
     * 请求参数
     */
    @ApiModelProperty(value = "请求参数")
    private String args;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private Integer createTime;



    /**
    * 查询数据过滤
    */
    public void query(UserVisitsSearchValidate searchValidate, LambdaQueryWrapper<UserVisits> lqw) {
        if (StringUtils.isNotObj(searchValidate.getUserId())) {
            lqw.eq(UserVisits::getUserId, searchValidate.getUserId());
        }
        if (StringUtils.isNotObj(searchValidate.getType())) {
            lqw.eq(UserVisits::getType, searchValidate.getType());
        }
        if (StringUtils.isNotObj(searchValidate.getIp())) {
            lqw.eq(UserVisits::getIp, searchValidate.getIp());
        }
        if (StringUtils.isNotObj(searchValidate.getUrl())) {
            lqw.eq(UserVisits::getUrl, searchValidate.getUrl());
        }
        if (StringUtils.isNotObj(searchValidate.getMethod())) {
            lqw.eq(UserVisits::getMethod, searchValidate.getMethod());
        }
        if (StringUtils.isNotObj(searchValidate.getArgs())) {
            lqw.eq(UserVisits::getArgs, searchValidate.getArgs());
        }
        if (StringUtils.isNotObj(searchValidate.getCreateTime())) {
            lqw.eq(UserVisits::getCreateTime, searchValidate.getCreateTime());
        }
    }

}